﻿using UnityEngine;
using System.Collections;
namespace Room
{
    public class RCUIStoryNPC : RCUIPlayer
    {
        public RCUIStoryNPC(RoomCharactor owner)
            :base(owner)
        {
            type = UIType.NormalNPC;
        }

        public string npcName;
        public string bubbleText;

        public void Init(string npcName,string bubbleText)
        {
            this.npcName = npcName;
            this.bubbleText = bubbleText;
            base.Init(npcName);
        }

        public override void DoStart()
        {
            base.DoStart();

            CreateBoxCollider();
        }
        public override void DoStop()
        {
            base.DoStop();
        }

        protected override void OnClick()
        {
            if(!string.IsNullOrEmpty(bubbleText))
                ShowBubble(bubbleText);

            var self = owner.charactorManager.GetSelfCharactor();
            if((self.transform.position-owner.transform.position).magnitude<2f)
            {
                DataMessageTool.AddMessage(DataMessage.NPC_CLICK, owner);
            }
        }
    }

}

